package com.zhibang.sinocare.test.controller;

import com.zhibang.sinocare.common.domian.Detection;
import com.zhibang.sinocare.common.domian.MedicalResult;
import com.zhibang.sinocare.common.result.Result;
import com.zhibang.sinocare.common.result.ResultCode;
import com.zhibang.sinocare.test.service.MedicalresultService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/medicalresult")
//@Api(tags = "用户管理模快",description = "对用户进行CRUD操作")
@CrossOrigin
public class MedicalresultController {
    @Resource
    private MedicalresultService medicalresultServiceImpl;

     //添加
    @RequestMapping(value = "add",method = RequestMethod.POST)
    @ApiOperation(value = "添加检测者",notes = "添加检测者",httpMethod = "POST")
    public Result addDetection(MedicalResult medicalResult)throws Exception{
        System.out.println(medicalResult);
        Detection detection1 = new Detection();
        detection1.setPatientId(8);
        boolean save = medicalresultServiceImpl.save(medicalResult);
        if (save){
            return Result.ok(ResultCode.SUCCESS,save);
        }else {
            return Result.ok(ResultCode.FAIL,null);
        }
    }

}
